package day03;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/10
 */
public class PerfectNumber {
    public static void main(String[] args) {
        System.out.println("50000以内的完备数有：");

        for (int number = 1; number <= 50000; number++) {
            int sum = 0; //约数之和

            for (int i = 1; i < number; i++) {
                if (number % i == 0) {
                    sum += i;
                }
            }

            // 如果约数之和等于该数本身，则是完备数
            if (sum == number) {
                System.out.println(number);
            }
        }
    }
}
